﻿using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
using System;

namespace EvoGame.Ceeforee.Helpers
{
	[Serializable]
	public class Civilization
	{
		public string Type, Description, ShortDescription, Adjective, Civilopedia;
		public string DefaultPlayerColor, ArtDefineTag, ArtStyleType, UnitArtStyleType;
		public string SelectionSound, ActionSound, DerivedCiv;
		public bool Playable, AIPlayable, Modified;
		public List<string> Cities;
		public List<Unit> UniqueUnits, StartingUnits;
		public List<Building> UniqueBuildings, StartingBuildings;
		public List<Technology> StartingTechs;
		public List<Civic> StartingCivics;
		public List<Leader> AvailableLeaders;

		public Civilization()
		{
			Modified = false;
			Cities = new List<string>();
			UniqueUnits = new List<Unit>();
			UniqueBuildings = new List<Building>();
			StartingUnits = new List<Unit>();
			StartingBuildings = new List<Building>();
			StartingTechs = new List<Technology>();
			StartingCivics = new List<Civic>();
			AvailableLeaders = new List<Leader>();
		}
	}

	[Serializable]
	public class Unit
	{
		public string ClassType, Type;

		public class Comparer : IEqualityComparer<Unit>
		{
			public bool Equals(Unit x, Unit y)
			{
				return x.ClassType == y.ClassType;
			}

			public int GetHashCode(Unit obj)
			{
				return obj.Type.GetHashCode();
			}
		}
	}

	[Serializable]
	public class Building
	{
		public string ClassType, Type, SpecialType, Description, Civilopedia;
		public string Strategy, Advisor, ArtDefineTag, MovieDefineTag, HolyCity;
		public string ReligionType, StateReligion, PrereqReligion, PrereqCorporation;
		public string FoundsCorporation, GlobalReligionCommerce, GlobalCorporationCommerce;
		public string VictoryPrereq, FreeStartEra, MaxStartEra, ObsoleteTech, PrereqTech;
		public string TechTypes, Bonus, PrereqBonuses, NoBonus, PowerBonus, FreeBonus;
		public string FreeBuilding, FreePromotion, CivicOption, GreatPeopleUnitClass;
		public string DiploVoteType, ContructSound;

		public int NumFreeBonuses, GreatPeopleRateChange, HurryAngerModifier, AIWeight;
		public int Cost, HurryCostModifier, AdvancedStartCost, AdvancedStartCostIncrease;
		public int MinAreaSize, ConquestProb, CitiesPrereq, TeamsPrereq, LevelPrereq;
		public int MinLatitude, MaxLatitude, GreatPeopleRateModifier, GreatGeneralRateModifier;
		public int DomesticGreatGeneralRateModifier, GlobalGreatPeopleRateModifer;
		public int AnarchyModifier, GoldenAgeModifier, GlobalHurryModifier, Experience;
		public int GlobalExperience, FoodKept, Airlift, AirModifier, AirUnitCapacity;
		public int NukeModifier, NukeExplosionRand, FreeSpecialist, AreaFreeSpecialist;
		public int GlobalFreeSpecialist, MaintenanceModifier, WarWearinessModifier;
		public int GlobalWarWearinessModifier, EnemyWarWearinessModifier, HealRateChange;
		public int Health, AreaHealth, GlobalHealth, Happiness, AreaHappiness, GlobalHappiness;
		public int StateReligionHappiness, WorkerSpeedModifier, MilitaryProductionModifier;
		public int SpaceProductionModifier, GlobalSpaceProductionModifier, TradeRoutes;
		public int CoastalTradeRoutes, GlobalTradeRoutes, TradeRouteModifier;
		public int ForeignTradeRouteModifier, GlobalPopulationChange, FreeTechs, Defence;
		public int BombardDefence, AllCityDefence, EspionageDefence, Asset, Power;

		public Helper.Vector<int> SeaPlotYieldChanges, RiverPlotYieldChanges;
		public Helper.Vector<int> GlobalSeaPlotYieldChanges, YieldChanges, CommerceChanges;
		public Helper.Vector<int> ObsoleteSafeCommerceChanges, CommerceChangeDoubleTimes;
		public Helper.Vector<int> CommerceModifiers;

		public float VisibilityPriority;

		public bool RequireStateReligion, BorderObstacle, TeamShare, Water, River;//, Power;
		public bool DirtyPower, AreaCleanPower, ForceTeamVoteEligible, Capital;
		public bool GovernmentCenter, GoldenAge, AllowsNukes, MapCentering, NoUnhappiness;
		public bool NoUnhealthyPopulation, BuildingOnlyHealthy, NeverCapture, NukeImmune;
		public bool RequireReligion, CenterInCity;

		public class Comparer : IEqualityComparer<Building>
		{
			public bool Equals(Building x, Building y)
			{
				return x.ClassType == y.ClassType;
			}

			public int GetHashCode(Building obj)
			{
				return obj.Type.GetHashCode();
			}
		}
	}


	[Serializable]
	public class Technology
	{
		public string Type;
	}

	[Serializable]
	public class Civic
	{
		public string Type;
	}

	[Serializable]
	public class Leader
	{
		public string Name;
	}
}